package com.example.skycode5.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
    private String FilwName;
    private int DBType;
    private Connection conn;
    private String MySqlDriver;
    private String MySqlIURL;
    public DBConnection() {
        conn = null;
    }
    public  Connection getConn() {
        DBType =1;
        switch (DBType) {
            case 1:return (getConnToMySql());
            default:return null;
        }
    }
    public Connection getConnToMySql(){
        try{
            MySqlDriver="com.mysql.jdbc.Driver";
            MySqlIURL="jdbc:mysql://localhost:3306/skycode5" +"?user=root&password=mysql&useUnicode=true"+"/+&characterEncoding=utf8";
            Class.forName(MySqlDriver).newInstance();
            conn= DriverManager.getConnection(MySqlIURL);
        }catch (Exception e){
        }
        return conn;
    }
}
